package com.vietnam.power.persitence;

import java.io.Serializable;

import javax.persistence.*;

import java.util.Date;
import java.util.List;


/**
 * The persistent class for the menu database table.
 * 
 */
@Entity
@Table(name="menu")
public class Menu implements Serializable {
	private static final long serialVersionUID = 1L;
	private int id;
	private Date createdDate;
	private String description;
	private String name;
	private boolean status;
	private Date updatedDate;
	private List<MenuAccessRight> menuAccessRights;
	private List<SubMenu> subMenus1;
	private List<SubMenu> subMenus2;

	public Menu() {
	}


	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}


	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="created_date")
	public Date getCreatedDate() {
		return this.createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}


	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}


	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public boolean getStatus() {
		return this.status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}


	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="updated_date")
	public Date getUpdatedDate() {
		return this.updatedDate;
	}

	public void setUpdatedDate(Date updatedDate) {
		this.updatedDate = updatedDate;
	}

	//bi-directional many-to-one association to MenuAccessRight
	@OneToMany(mappedBy="menu")
	public List<MenuAccessRight> getMenuAccessRights() {
		return this.menuAccessRights;
	}

	public void setMenuAccessRights(List<MenuAccessRight> menuAccessRights) {
		this.menuAccessRights = menuAccessRights;
	}

	public MenuAccessRight addMenuAccessRight(MenuAccessRight menuAccessRight) {
		getMenuAccessRights().add(menuAccessRight);
		menuAccessRight.setMenu(this);

		return menuAccessRight;
	}

	public MenuAccessRight removeMenuAccessRight(MenuAccessRight menuAccessRight) {
		getMenuAccessRights().remove(menuAccessRight);
		menuAccessRight.setMenu(null);

		return menuAccessRight;
	}


	//bi-directional many-to-one association to SubMenu
	@OneToMany(mappedBy="menu1")
	public List<SubMenu> getSubMenus1() {
		return this.subMenus1;
	}

	public void setSubMenus1(List<SubMenu> subMenus1) {
		this.subMenus1 = subMenus1;
	}

	public SubMenu addSubMenus1(SubMenu subMenus1) {
		getSubMenus1().add(subMenus1);
		subMenus1.setMenu1(this);

		return subMenus1;
	}

	public SubMenu removeSubMenus1(SubMenu subMenus1) {
		getSubMenus1().remove(subMenus1);
		subMenus1.setMenu1(null);

		return subMenus1;
	}


	//bi-directional many-to-one association to SubMenu
	@OneToMany(mappedBy="menu2")
	public List<SubMenu> getSubMenus2() {
		return this.subMenus2;
	}

	public void setSubMenus2(List<SubMenu> subMenus2) {
		this.subMenus2 = subMenus2;
	}

	public SubMenu addSubMenus2(SubMenu subMenus2) {
		getSubMenus2().add(subMenus2);
		subMenus2.setMenu2(this);

		return subMenus2;
	}

	public SubMenu removeSubMenus2(SubMenu subMenus2) {
		getSubMenus2().remove(subMenus2);
		subMenus2.setMenu2(null);

		return subMenus2;
	}

}